<?php 
/****

	If you want the best of the world,
give the world your best anytime！
            				——不二
                							
****/

defined('ACCESS')||exit('Forbidden!');
//顶层action类
class Action {
	protected $view;

	public function __construct(){
		$this->view = new View();
	}

	//成功跳转
	protected function success($msg,$url='index.php',$time=3){
		//加载跳转页面
		//include_once(VIEW.'/redirect.html');
		$this->view->assign('msg',$msg);
		$this->view->assign('url',$url);
		$this->view->assign('time',$time);
		$this->view->display('redirect.html');
	}

	//失败跳转
	protected function failure($msg,$url='index.php',$time=3){
		//加载跳转页面
		//include_once(VIEW_DIR.'/redirect.html');
		$this->view->assign('msg',$msg);
		$this->view->assign('url',$url);
		$this->view->assign('time',$time);
		$this->view->display('redirect.html');
		die();
	}

	//加载模板
	protected function display($template){
		$this->view->display($template);
	}

	//传入数据
	protected function assign($key,$value){
		$this->view->assign($key,$value);
	}

	//获取post和get数据
	protected function I($id){
		return isset($_GET[$id])?$_GET[$id]:$_POST[$id];
	}
}
